package com.inspur.demo.web;

import com.inspur.demo.core.SysUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Random;

/**
 * @ClassName HelloController
 * @Description TODO
 * @Company inspur
 * @Author Mark.Zhang
 * @Date 2019/5/16 9:56
 * @Version 1.0 
 */
@Slf4j
@Controller
@PropertySource(value = "classpath:constant.properties")
public class HelloController {
    @Value("${com.inspur.name}")
    private String name;

    @Autowired
    SysUser sysUser;

//    访问路由
    @RequestMapping(value = "/hello")
    @ResponseBody
    public String say() throws Exception {
        log.debug("debug message");
        log.warn("warn message");
        log.info("info message");
        log.error("error message");
        log.trace("trace message");
        return "Hello world" + name + sysUser.toString();
    }
}
